package com.pd.backend.controller;

import com.pd.backend.dtos.PagePdAuthUserDto;
import com.pd.backend.dtos.PdAuthUserDto;
import com.pd.backend.dtos.PdAuthUserUpdateDto;
import com.pd.backend.dtos.ResponseResult;
import com.pd.backend.pojo.PdAuthUser;
import com.pd.backend.service.PdAuthUserService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * 用户管理控制层
 *
 * @Auther : 菜鸡编程
 * @Date:2023/1/14
 * @Description:
 * @VERSON:1.8
 */
@RestController
@Slf4j
@RequestMapping(path = "/authUser")
@Api(tags = "用户管理")
public class PdAuthUserController {

    @Autowired
    private PdAuthUserService pdAuthUserService;

    /**
     * 用户管理:分页模糊查询
     *
     * @param pagePdAuthUserDto
     * @return
     */
    @ApiOperation("用户管理:分页模糊查询")
    @GetMapping("/page")
    public ResponseResult authUserPage(PagePdAuthUserDto pagePdAuthUserDto) {
        return pdAuthUserService.authUserPage(pagePdAuthUserDto);
    }


    /**
     * 新增用户
     *
     * @param pdAuthUserDto
     * @return
     */

    @ApiOperation("新增用户")
    @PostMapping("/add")
    public ResponseResult authUserAdd(@RequestBody PdAuthUserDto pdAuthUserDto) {
        return pdAuthUserService.authUserAdd(pdAuthUserDto);
    }

    /**
<<<<<<< HEAD
     * 查询全部快递员
     * @return
     */
    @ApiOperation("查询全部快递员")
    @GetMapping("/selectAllCourier")
    public ResponseResult<List<PdAuthUser>> selectAllCourier(){
        return pdAuthUserService.selectAllCourier();
    }

=======
     * 根据用户id查询用户
     * @param id
     * @return
     */
    @ApiOperation("根据用户id查询用户(回显)")
    @GetMapping("/select")
    public ResponseResult selectById(Long id) {
        return pdAuthUserService.selectById(id);
    }

    /**
     * 根据用户id修改用户
     * @param
     * @return
     */
    @ApiOperation("根据用户id修改用户")
    @PutMapping("/update")
    public ResponseResult updateById(@RequestBody PdAuthUserUpdateDto pdAuthUserUpdateDto){
        return pdAuthUserService.updateById(pdAuthUserUpdateDto);
    }
>>>>>>> zhuhuanxin-01
}
